import type { BannerItem, CategoryItem, HotItem, GoodsItem } from '@/types/home'
import type { PageParams, PageResult } from '@/types/global'
import { http } from '@/utils/http'

/**
 * 获取首页轮播图-小程序
 * @param distributionSite,2为分类，1为首页
 */
export const getHomeBanner = (distributionSite: number) => {
  return http<BannerItem[]>({
    url: '/home/banner',
    method: 'GET',
    data: {
      distributionSite,
    },
  })
}

/**
 * 获取首页分类导航-小程序
 */
export const getHomeCategory = () => {
  return http<CategoryItem[]>({
    url: '/home/category/mutli',
    method: 'GET',
  })
}

/**
 * 获取热门推荐数据-小程序
 */
export const getHomeHot = () => {
  return http<HotItem[]>({
    url: '/home/hot/mutli',
    method: 'GET',
  })
}

/**
 * 获取首页猜你喜欢数据-小程序
 */
export const getHomeGoodsGuessLike = (data?: PageParams) => {
  return http<PageResult<GoodsItem>>({
    url: '/home/goods/guessLike',
    method: 'GET',
    data,
  })
}
